package com.ticket.sass.provider.dto.input.film;

import com.ticket.sass.provider.validator.InEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;

import javax.validation.constraints.AssertTrue;
import javax.validation.constraints.NotBlank;

/**
 * @author ywb
 * @date 2024-04-18 17:33
 */
@Data
@AllArgsConstructor
public class FilmQueryInput {
    @NotBlank(message = "请输入服务地址")
    @ApiModelProperty(value = "服务地址")
    private String serverUrl;
    
    @InEnum(intValues = {1})
    @ApiModelProperty(value = "查询类型 1 猫眼")
    private Short type;
    
    @AssertTrue(message = "服务地址必须以纯数字结尾")
    public boolean isServerUrl() {
        // 判断字符串是否以纯数字结尾
        return serverUrl != null && serverUrl.matches(".*\\d+$");
    }
}
